<template>
	<view class="uni-popup-share">
		<h3 class='header'>预览</h3>
		<view class="dateAndLogo">
			<view class="date">
				<text class="day">{{date.day}} </text>
				<text class="year">{{date.month}} . {{date.year}}</text>
			</view>
			<image :src="logo"></image>
		</view>
		<view class="diaryBox">
			<view class="cardImgTop">
				<image class="img" :src="topImg" aspectFill></image>
			</view>
			<view class="diaryImgBox">
				<image class="diaryImg" :src="imgUrl" aspectFill></image>
			</view>
			<view class="content">
				<text class="content">{{content}}</text>
			</view>
			<view class="code">
				<text class="diaryFooter">——  {{name}}</text>
				<image class="qrCode" :src="qrCode"></image>
			</view>
		</view>
		<view class="uni-share-button-box">
			<button class="uni-share-button-cancel" @click="close">关闭</button>
			<view class="line">|</view>
			<button class="uni-share-button-share" open-type='share' bindtap="onShareAppMessage">分享</button>
		</view>
	</view>
</template>

<script>
	// import uniPopup from '@/components/uni-popup/uni-popup.vue'
	// import uniPopupShareWeixin from '@/components/uni-popup/uni-popup-share-weixin.vue'
	export default {
		// components: {
		// 	uniPopup,
		// 	uniPopupShareWeixin
		// },
		name: 'UniPopupShareDiary',
		props: {
			imgUrl: {
				type: String,
				default: ''
			},
			content: {
				type: String,
				default: '分享到'
			},
			diaryImg:{
				type: String,
				default: ''
			},
			weinxinHref: {
				type: String,
				default: ''
			},
			topImg: {
				type: String,
				default: ''
			},
			logo: {
				type: String,
				default: ''
			},
			date: {
				type: Object,
				default: function() {
					return {}
				}
			},
			shareDiary:{
				type: Function,
				default: null
			},
			name: {
				type: String,
				default: ''
			},
			qrCode: {
				type: String,
				default: ''
			}
		},
		inject: ['popup'],
		data() {
			return {}
		},
		methods: {
			onShareAppMessage(res) {
			    return {
					title: "发送给好友",
					url:'/card/share',
					imgUrl: '',
			    }
			},
			/**
			 * 关闭窗口
			 */
			close() {
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss" scoped>
	.header {
		height: 100rpx;
		font-size: 36rpx;
		font-weight: 400;
		color: rgba(102, 100, 93, 1);
		line-height: 100rpx;
		text-align: center;
	}

	.dateAndLogo {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 28rpx;
	}

	.dateAndLogo image {
		width: 256rpx;
		height: 35rpx;
	}

	.diaryFooter {
		height: 86rpx;
		font-size: 22rpx;
		font-weight: 300;
		color: rgba(138, 140, 141, 1);
		line-height: 46rpx;
		display: block;
		padding-bottom: 20rpx;
	}

	.content {
		font-size: 18rpx;
		color: #66645D;
		overflow : hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	.uni-popup-share {
		background-color: #fff;
		border-radius: 12rpx;
		width: 670rpx;
	}

	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		background: #F8F8F8;
		border-radius: 50px;
		margin-top: 42rpx;
	}

	.uni-share-button-share {
		flex: 1;
		color: rgba(102, 100, 93, 1);
		font-size: 16px;
		border-radius: 0 0 12rpx 0;
	}

	.uni-share-button-cancel {
		flex: 1;
		color: rgba(102, 100, 93, 1);
		font-size: 16px;
		border-radius: 0 0 0 12rpx;
	}

	.uni-share-button-cancel::after {
		border: 0;
	}

	.uni-share-button-share::after {
		border: 0;
	}

	.line {
		color: rgba(102, 100, 93, 0.15);
		background: #f8f8f8;
		line-height: 40rpx;
	}

	.date {
		height: 90rpx;
		line-height: 90rpx;
		font-family: DIN Alternate Bold;
		color: rgba(102, 100, 93, 1);
	}

	.day {
		font-size: 54rpx;
		padding: 0 10rpx;
	}

	.year {
		font-size: 22rpx;
		padding: 0 10rpx;
	}

	.diaryBox {
		background: rgba(255, 255, 255, 1);
		box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(102, 100, 93, 0.1);
		border-radius: 20rpx;
		width: 590rpx;
		position: relative;
		margin: 0 40rpx;
		padding: 0 28rpx;
	}

	.diaryBox text {
		margin: 40rpx 40rpx 48rpx;
		color: rgba(102, 100, 93, 1);
		line-height: 46rpx;
		display: block;

	}

	.diaryImgBox {
		position: relative;
		height: 300rpx;
		z-index: 1;
		display: flex;
		justify-content: space-around;
		align-items: center;
		overflow: hidden;
	}
	
	.cardImgTop {
		position: relative;
		height: 217rpx;
		z-index: 1;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
	.img {
		border-radius: 20rpx;
	}
	.cardImgTop image {
		height: 217rpx;
	}

	.diaryImg {
		position: absolute;
		width: 100%;
		height: 300rpx;
		z-index: -1;
		border-radius: 20rpx;
		margin-top: 10rpx;
	}

	.diaryOutFooter {
		border-bottom: 1rpx solid rgba(102, 100, 93, .4);
		width: 60%;
		margin: 136rpx auto 142rpx;
		position: relative;
		display: block;
		position: relative;
		text-align: center;
		font-size: 24rpx;
	}

	.diaryOutFooter text {
		padding: 0 30rpx;
		position: absolute;
		color: rgba(138, 140, 141, 1);
		left: 125rpx;
		bottom: -14rpx;
		background: #fff;
	}
	.code {
		display: flex;
		justify-content: space-between;
	}
	.qrCode {
		width: 120rpx;
		height: 120rpx;
		margin-right: 40rpx;
	}
</style>
